'use strict';
const { Model } = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class Question extends Model {
    static associate(models) {
      Question.belongsTo(models.Theme, { foreignKey: 'themeId' });
      Question.hasMany(models.Answer, { foreignKey: 'questionId' });
    }
  }
  Question.init(
    {
      question: DataTypes.STRING,
      rightAnswer: DataTypes.INTEGER,
      themeId: DataTypes.INTEGER,
    },
    {
      sequelize,
      modelName: 'Question',
    },
  );
  return Question;
};
